---
layout: api-page
title: "Model.js"
id: api
---

<main class="api-documentation-page">
  

  
  
      
<h2>
    Model.js
</h2>
<section>
    <article>
        <pre class="prettyprint source linenums"><code>var ModelRoot = require("./ModelRoot");
var ModelDataSourceAdapter = require("./ModelDataSourceAdapter");

var RequestQueue = require("./request/RequestQueueV2");
var ModelResponse = require("./response/ModelResponse");
var CallResponse = require("./response/CallResponse");
var InvalidateResponse = require("./response/InvalidateResponse");

var ASAPScheduler = require("./schedulers/ASAPScheduler");
var TimeoutScheduler = require("./schedulers/TimeoutScheduler");
var ImmediateScheduler = require("./schedulers/ImmediateScheduler");

var arrayClone = require("./support/array-clone");
var arraySlice = require("./support/array-slice");

var collectLru = require("./lru/collect");
var pathSyntax = require("falcor-path-syntax");

var getSize = require("./support/getSize");
var isObject = require("./support/isObject");
var isPrimitive = require("./support/isPrimitive");
var isJSONEnvelope = require("./support/isJSONEnvelope");
var isJSONGraphEnvelope = require("./support/isJSONGraphEnvelope");

var setCache = require("./set/setPathMaps");
var setJSONGraphs = require("./set/setJSONGraphs");
var jsong = require("falcor-json-graph");
var ID = 0;
var validateInput = require("./support/validateInput");
var noOp = function() {};
var getCache = require("./get/getCache");
var get = require("./get");
var GET_VALID_INPUT = require("./response/get/validInput");

module.exports = Model;

Model.ref = jsong.ref;
Model.atom = jsong.atom;
Model.error = jsong.error;
Model.pathValue = jsong.pathValue;
/**
 * This callback is invoked when the Model's cache is changed.
 * @callback Model~onChange
 */

 /**
 * This function is invoked on every JSONGraph Error retrieved from the DataSource. This function allows Error objects to be transformed before being stored in the Model's cache.
 * @callback Model~errorSelector
 * @param {Object} jsonGraphError - the JSONGraph Error object to transform before it is stored in the Model's cache.
 * @returns {Object} the JSONGraph Error object to store in the Model cache.
 */

 /**
 * This function is invoked every time a value in the Model cache is about to be replaced with a new value. If the function returns true, the existing value is replaced with a new value and the version flag on all of the value's ancestors in the tree are incremented.
 * @callback Model~comparator
 * @param {Object} existingValue - the current value in the Model cache.
 * @param {Object} newValue - the value about to be set into the Model cache.
 * @returns {Boolean} the Boolean value indicating whether the new value and the existing value are equal.
 */

/**
 * A Model object is used to execute commands against a {@link JSONGraph} object. {@link Model}s can work with a local JSONGraph cache, or it can work with a remote {@link JSONGraph} object through a {@link DataSource}.
 * @constructor
 * @param {?Object} options - a set of options to customize behavior
 * @param {?DataSource} options.source - a data source to retrieve and manage the {@link JSONGraph}
 * @param {?JSONGraph} options.cache - initial state of the {@link JSONGraph}
 * @param {?number} options.maxSize - the maximum size of the cache. This value roughly correlates to item count (where itemCount = maxSize / 50). Each item by default is given a metadata `$size` of 50 (or its length when it's an array or string). You can get better control of falcor's memory usage by tweaking `$size`
 * @param {?number} options.maxRetries - the maximum number of times that the Model will attempt to retrieve the value from the server.
 * @param {?number} options.collectRatio - the ratio of the maximum size to collect when the maxSize is exceeded
 * @param {?Model~errorSelector} options.errorSelector - a function used to translate errors before they are returned
 * @param {?Model~onChange} options.onChange - a function called whenever the Model's cache is changed
 * @param {?Model~comparator} options.comparator - a function called whenever a value in the Model's cache is about to be replaced with a new value.
 */
function Model(o) {

    var options = o || {};
    this._root = options._root || new ModelRoot(options);
    this._path = options.path || options._path || [];
    this._scheduler = options.scheduler || options._scheduler || new ImmediateScheduler();
    this._source = options.source || options._source;
    this._request = options.request || options._request || new RequestQueue(this, this._scheduler);
    this._ID = ID++;

    if (typeof options.maxSize === "number") {
        this._maxSize = options.maxSize;
    } else {
        this._maxSize = options._maxSize || Model.prototype._maxSize;
    }

    if (typeof options.maxRetries === "number") {
        this._maxRetries = options.maxRetries;
    } else {
        this._maxRetries = options._maxRetries || Model.prototype._maxRetries;
    }

    if (typeof options.collectRatio === "number") {
        this._collectRatio = options.collectRatio;
    } else {
        this._collectRatio = options._collectRatio || Model.prototype._collectRatio;
    }

    if (options.boxed || options.hasOwnProperty("_boxed")) {
        this._boxed = options.boxed || options._boxed;
    }

    if (options.materialized || options.hasOwnProperty("_materialized")) {
        this._materialized = options.materialized || options._materialized;
    }

    if (typeof options.treatErrorsAsValues === "boolean") {
        this._treatErrorsAsValues = options.treatErrorsAsValues;
    } else if (options.hasOwnProperty("_treatErrorsAsValues")) {
        this._treatErrorsAsValues = options._treatErrorsAsValues;
    }

    this._useServerPaths = options._useServerPaths || false;

    this._allowFromWhenceYouCame = options.allowFromWhenceYouCame ||
        options._allowFromWhenceYouCame || false;

    this._treatDataSourceErrorsAsJSONGraphErrors = options._treatDataSourceErrorsAsJSONGraphErrors || false;

    if (options.cache) {
        this.setCache(options.cache);
    }
}

Model.prototype.constructor = Model;

Model.prototype._materialized = false;
Model.prototype._boxed = false;
Model.prototype._progressive = false;
Model.prototype._treatErrorsAsValues = false;
Model.prototype._maxSize = Math.pow(2, 53) - 1;
Model.prototype._maxRetries = 3;
Model.prototype._collectRatio = 0.75;

/**
 * The get method retrieves several {@link Path}s or {@link PathSet}s from a {@link Model}. The get method loads each value into a JSON object and returns in a ModelResponse.
 * @function
 * @param {...PathSet} path - the path(s) to retrieve
 * @return {ModelResponse.&lt;JSONEnvelope>} - the requested data as JSON
 */
Model.prototype.get = require("./response/get");

/**
 * _getOptimizedBoundPath is an extension point for internal users to polyfill
 * legacy soft-bind behavior, as opposed to deref (hardBind). Current falcor
 * only supports deref, and assumes _path to be a fully optimized path.
 * @function
 * @private
 * @return {Path} - fully optimized bound path for the model
 */
Model.prototype._getOptimizedBoundPath = function _getOptimizedBoundPath() {
    return arrayClone(this._path);
};

/**
 * The get method retrieves several {@link Path}s or {@link PathSet}s from a {@link Model}. The get method loads each value into a JSON object and returns in a ModelResponse.
 * @function
 * @private
 * @param {Array.&lt;PathSet>} paths - the path(s) to retrieve
 * @return {ModelResponse.&lt;JSONEnvelope>} - the requested data as JSON
 */
Model.prototype._getWithPaths = require("./response/get/getWithPaths");

/**
 * Sets the value at one or more places in the JSONGraph model. The set method accepts one or more {@link PathValue}s, each of which is a combination of a location in the document and the value to place there.  In addition to accepting  {@link PathValue}s, the set method also returns the values after the set operation is complete.
 * @function
 * @return {ModelResponse.&lt;JSONEnvelope>} - an {@link Observable} stream containing the values in the JSONGraph model after the set was attempted
 */
Model.prototype.set = require("./response/set");

/**
 * The preload method retrieves several {@link Path}s or {@link PathSet}s from a {@link Model} and loads them into the Model cache.
 * @function
 * @param {...PathSet} path - the path(s) to retrieve
 * @return {ModelResponse.&lt;JSONEnvelope>} - a ModelResponse that completes when the data has been loaded into the cache.
 */
Model.prototype.preload = function preload() {
    var out = validateInput(arguments, GET_VALID_INPUT, "preload");
    if (out !== true) {
        return new ModelResponse(function(o) {
            o.onError(out);
        });
    }
    var args = Array.prototype.slice.call(arguments);
    var self = this;
    return new ModelResponse(function(obs) {
        return self.get.apply(self, args).subscribe(function() {
        }, function(err) {
            obs.onError(err);
        }, function() {
            obs.onCompleted();
        });
    });
};

/**
 * Invokes a function in the JSON Graph.
 * @function
 * @param {Path} functionPath - the path to the function to invoke
 * @param {Array.&lt;Object>} args - the arguments to pass to the function
 * @param {Array.&lt;PathSet>} refPaths - the paths to retrieve from the JSON Graph References in the message returned from the function
 * @param {Array.&lt;PathSet>} thisPaths - the paths to retrieve from function's this object after successful function execution
 * @return {ModelResponse.&lt;JSONEnvelope> - a JSONEnvelope contains the values returned from the function
 */
Model.prototype.call = function call() {
    var args;
    var argsIdx = -1;
    var argsLen = arguments.length;
    args = new Array(argsLen);
    while (++argsIdx &lt; argsLen) {
        var arg = arguments[argsIdx];
        args[argsIdx] = arg;
        var argType = typeof arg;
        if (argsIdx > 1 &amp;&amp; !Array.isArray(arg) ||
            argsIdx === 0 &amp;&amp; !Array.isArray(arg) &amp;&amp; argType !== "string" ||
            argsIdx === 1 &amp;&amp; !Array.isArray(arg) &amp;&amp; !isPrimitive(arg)) {
            /* eslint-disable no-loop-func */
            return new ModelResponse(function(o) {
                o.onError(new Error("Invalid argument"));
            });
            /* eslint-enable no-loop-func */
        }
    }

    return new CallResponse(this, args[0], args[1], args[2], args[3]);
};

/**
 * The invalidate method synchronously removes several {@link Path}s or {@link PathSet}s from a {@link Model} cache.
 * @function
 * @param {...PathSet} path - the  paths to remove from the {@link Model}'s cache.
 */
Model.prototype.invalidate = function invalidate() {
    var args;
    var argsIdx = -1;
    var argsLen = arguments.length;
    args = [];
    while (++argsIdx &lt; argsLen) {
        args[argsIdx] = pathSyntax.fromPath(arguments[argsIdx]);
        if (!Array.isArray(args[argsIdx]) || !args[argsIdx].length) {
            throw new Error("Invalid argument");
        }
    }

    // creates the obs, subscribes and will throw the errors if encountered.
    (new InvalidateResponse(this, args)).
        subscribe(noOp, function(e) {
            throw e;
        });
};

/**
 * Returns a new {@link Model} bound to a location within the {@link
 * JSONGraph}. The bound location is never a {@link Reference}: any {@link
 * Reference}s encountered while resolving the bound {@link Path} are always
 * replaced with the {@link Reference}s target value. For subsequent operations
 * on the {@link Model}, all paths will be evaluated relative to the bound
 * path. Deref allows you to:
 * - Expose only a fragment of the {@link JSONGraph} to components, rather than
 *   the entire graph
 * - Hide the location of a {@link JSONGraph} fragment from components
 * - Optimize for executing multiple operations and path looksup at/below the
 *   same location in the {@link JSONGraph}
 * @method
 * @param {Object} responseObject - an object previously retrieved from the
 * Model
 * @return {Model} - the dereferenced {@link Model}
 * @example
var Model = falcor.Model;
var model = new Model({
  cache: {
    users: [
      Model.ref(["usersById", 32])
    ],
    usersById: {
      32: {
        name: "Steve",
        surname: "McGuire"
      }
    }
  }
});

model.
    get(['users', 0, 'name']).
    subscribe(function(jsonEnv) {
        var userModel = model.deref(jsonEnv.json.users[0]);
        console.log(model.getPath());
        console.log(userModel.getPath());
   });
});

// prints the following:
// []
// ["usersById", 32] - because userModel refers to target of reference at ["users", 0]
 */
Model.prototype.deref = require("./deref");

/**
 * A dereferenced model can become invalid when the reference from which it was
 * built has been removed/collected/expired/etc etc.  To fix the issue, a from
 * the parent request should be made (no parent, then from the root) for a valid
 * path and re-dereference performed to update what the model is bound too.
 *
 * @method
 * @private
 * @return {Boolean} - If the currently deref'd model is still considered a
 * valid deref.
 */
Model.prototype._hasValidParentReference = require("./deref/hasValidParentReference");

/**
 * Get data for a single {@link Path}.
 * @param {Path} path - the path to retrieve
 * @return {Observable.&lt;*>} - the value for the path
 * @example
 var model = new falcor.Model({source: new falcor.HttpDataSource("/model.json") });

 model.
     getValue('user.name').
     subscribe(function(name) {
         console.log(name);
     });

 // The code above prints "Jim" to the console.
 */
Model.prototype.getValue = require("./get/getValue");

/**
 * Set value for a single {@link Path}.
 * @param {Path} path - the path to set
 * @param {Object} value - the value to set
 * @return {Observable.&lt;*>} - the value for the path
 * @example
 var model = new falcor.Model({source: new falcor.HttpDataSource("/model.json") });

 model.
     setValue('user.name', 'Jim').
     subscribe(function(name) {
         console.log(name);
     });

 // The code above prints "Jim" to the console.
 */
Model.prototype.setValue = require("./set/setValue");

// TODO: Does not throw if given a PathSet rather than a Path, not sure if it should or not.
// TODO: Doc not accurate? I was able to invoke directly against the Model, perhaps because I don't have a data source?
// TODO: Not clear on what it means to "retrieve objects in addition to JSONGraph values"
/**
 * Synchronously retrieves a single path from the local {@link Model} only and will not retrieve missing paths from the {@link DataSource}. This method can only be invoked when the {@link Model} does not have a {@link DataSource} or from within a selector function. See {@link Model.prototype.get}. The getValueSync method differs from the asynchronous get methods (ex. get, getValues) in that it can be used to retrieve objects in addition to JSONGraph values.
 * @method
 * @private
 * @arg {Path} path - the path to retrieve
 * @return {*} - the value for the specified path
 */
Model.prototype._getValueSync = require("./get/sync");

/**
 * @private
 */
Model.prototype._setValueSync = require("./set/sync");

/**
 * @private
 */
Model.prototype._derefSync = require("./deref/sync");

/**
 * Set the local cache to a {@link JSONGraph} fragment. This method can be a useful way of mocking a remote document, or restoring the local cache from a previously stored state.
 * @param {JSONGraph} jsonGraph - the {@link JSONGraph} fragment to use as the local cache
 */
Model.prototype.setCache = function modelSetCache(cacheOrJSONGraphEnvelope) {
    var cache = this._root.cache;
    if (cacheOrJSONGraphEnvelope !== cache) {
        var modelRoot = this._root;
        var boundPath = this._path;
        this._path = [];
        this._root.cache = {};
        if (typeof cache !== "undefined") {
            collectLru(modelRoot, modelRoot.expired, getSize(cache), 0);
        }
        var out;
        if (isJSONGraphEnvelope(cacheOrJSONGraphEnvelope)) {
            out = setJSONGraphs(this, [cacheOrJSONGraphEnvelope])[0];
        } else if (isJSONEnvelope(cacheOrJSONGraphEnvelope)) {
            out = setCache(this, [cacheOrJSONGraphEnvelope])[0];
        } else if (isObject(cacheOrJSONGraphEnvelope)) {
            out = setCache(this, [{ json: cacheOrJSONGraphEnvelope }])[0];
        }

        // performs promotion without producing output.
        if (out) {
            get.getWithPathsAsPathMap(this, out, []);
        }
        this._path = boundPath;
    } else if (typeof cache === "undefined") {
        this._root.cache = {};
    }
    return this;
};

/**
 * Get the local {@link JSONGraph} cache. This method can be a useful to store the state of the cache.
 * @param {...Array.&lt;PathSet>} [pathSets] - The path(s) to retrieve. If no paths are specified, the entire {@link JSONGraph} is returned.
 * @return {JSONGraph} all of the {@link JSONGraph} data in the {@link Model} cache.
 * @example
 // Storing the boxshot of the first 10 titles in the first 10 genreLists to local storage.
 localStorage.setItem('cache', JSON.stringify(model.getCache("genreLists[0...10][0...10].boxshot")));
 */
Model.prototype.getCache = function _getCache() {
    var paths = arraySlice(arguments);
    if (paths.length === 0) {
        return getCache(this._root.cache);
    }

    var result = [{}];
    var path = this._path;
    get.getWithPathsAsJSONGraph(this, paths, result);
    this._path = path;
    return result[0].jsonGraph;
};

/**
 * Reset cache maxSize. When the new maxSize is smaller than the old force a collect.
 * @param {Number} maxSize - the new maximum cache size
 */
Model.prototype._setMaxSize = function setMaxSize(maxSize) {
    var oldMaxSize = this._maxSize;
    this._maxSize = maxSize;
    if (maxSize &lt; oldMaxSize) {
        var modelRoot = this._root;
        var modelCache = modelRoot.cache;
        // eslint-disable-next-line no-cond-assign
        var currentVersion = modelCache.$_version;
        collectLru(modelRoot, modelRoot.expired, getSize(modelCache),
                this._maxSize, this._collectRatio, currentVersion);
    }
};

/**
 * Retrieves a number which is incremented every single time a value is changed underneath the Model or the object at an optionally-provided Path beneath the Model.
 * @param {Path?} path - a path at which to retrieve the version number
 * @return {Number} a version number which changes whenever a value is changed underneath the Model or provided Path
 */
Model.prototype.getVersion = function getVersion(pathArg) {
    var path = pathArg &amp;&amp; pathSyntax.fromPath(pathArg) || [];
    if (Array.isArray(path) === false) {
        throw new Error("Model#getVersion must be called with an Array path.");
    }
    if (this._path.length) {
        path = this._path.concat(path);
    }
    return this._getVersion(this, path);
};

Model.prototype._syncCheck = function syncCheck(name) {
    if (Boolean(this._source) &amp;&amp; this._root.syncRefCount &lt;= 0 &amp;&amp; this._root.unsafeMode === false) {
        throw new Error("Model#" + name + " may only be called within the context of a request selector.");
    }
    return true;
};

/* eslint-disable guard-for-in */
Model.prototype._clone = function cloneModel(opts) {
    var clone = new Model(this);
    for (var key in opts) {
        var value = opts[key];
        if (value === "delete") {
            delete clone[key];
        } else {
            clone[key] = value;
        }
    }
    clone.setCache = void 0;
    return clone;
};
/* eslint-enable */

/**
 * Returns a clone of the {@link Model} that enables batching. Within the configured time period, paths for get operations are collected and sent to the {@link DataSource} in a batch. Batching can be more efficient if the {@link DataSource} access the network, potentially reducing the number of HTTP requests to the server.
 * @param {?Scheduler|number} schedulerOrDelay - Either a {@link Scheduler} that determines when to send a batch to the {@link DataSource}, or the number in milliseconds to collect a batch before sending to the {@link DataSource}. If this parameter is omitted, then batch collection ends at the end of the next tick.
 * @return {Model} a Model which schedules a batch of get requests to the DataSource.
 */
Model.prototype.batch = function batch(schedulerOrDelayArg) {
    var schedulerOrDelay = schedulerOrDelayArg;
    if (typeof schedulerOrDelay === "number") {
        schedulerOrDelay = new TimeoutScheduler(Math.round(Math.abs(schedulerOrDelay)));
    } else if (!schedulerOrDelay || !schedulerOrDelay.schedule) {
        schedulerOrDelay = new ASAPScheduler();
    }
    var clone = this._clone();
    clone._request = new RequestQueue(clone, schedulerOrDelay);

    return clone;
};

/**
 * Returns a clone of the {@link Model} that disables batching. This is the default mode. Each get operation will be executed on the {@link DataSource} separately.
 * @name unbatch
 * @memberof Model.prototype
 * @function
 * @return {Model} a {@link Model} that batches requests of the same type and sends them to the data source together
 */
Model.prototype.unbatch = function unbatch() {
    var clone = this._clone();
    clone._request = new RequestQueue(clone, new ImmediateScheduler());
    return clone;
};

/**
 * Returns a clone of the {@link Model} that treats errors as values. Errors will be reported in the same callback used to report data. Errors will appear as objects in responses, rather than being sent to the {@link Observable~onErrorCallback} callback of the {@link ModelResponse}.
 * @return {Model}
 */
Model.prototype.treatErrorsAsValues = function treatErrorsAsValues() {
    return this._clone({
        _treatErrorsAsValues: true
    });
};

/**
 * Adapts a Model to the {@link DataSource} interface.
 * @return {DataSource}
 * @example
var model =
    new falcor.Model({
        cache: {
            user: {
                name: "Steve",
                surname: "McGuire"
            }
        }
    }),
    proxyModel = new falcor.Model({ source: model.asDataSource() });

// Prints "Steve"
proxyModel.getValue("user.name").
    then(function(name) {
        console.log(name);
    });
 */
Model.prototype.asDataSource = function asDataSource() {
    return new ModelDataSourceAdapter(this);
};

Model.prototype._materialize = function materialize() {
    return this._clone({
        _materialized: true
    });
};

Model.prototype._dematerialize = function dematerialize() {
    return this._clone({
        _materialized: "delete"
    });
};

/**
 * Returns a clone of the {@link Model} that boxes values returning the wrapper ({@link Atom}, {@link Reference}, or {@link Error}), rather than the value inside it. This allows any metadata attached to the wrapper to be inspected.
 * @return {Model}
 */
Model.prototype.boxValues = function boxValues() {
    return this._clone({
        _boxed: true
    });
};

/**
 * Returns a clone of the {@link Model} that unboxes values, returning the value inside of the wrapper ({@link Atom}, {@link Reference}, or {@link Error}), rather than the wrapper itself. This is the default mode.
 * @return {Model}
 */
Model.prototype.unboxValues = function unboxValues() {
    return this._clone({
        _boxed: "delete"
    });
};

/**
 * Returns a clone of the {@link Model} that only uses the local {@link JSONGraph} and never uses a {@link DataSource} to retrieve missing paths.
 * @return {Model}
 */
Model.prototype.withoutDataSource = function withoutDataSource() {
    return this._clone({
        _source: "delete"
    });
};

Model.prototype.toJSON = function toJSON() {
    return {
        $type: "ref",
        value: this._path
    };
};

/**
 * Returns the {@link Path} to the object within the JSON Graph that this Model references.
 * @return {Path}
 * @example
var Model = falcor.Model;
var model = new Model({
  cache: {
    users: [
      Model.ref(["usersById", 32])
    ],
    usersById: {
      32: {
        name: "Steve",
        surname: "McGuire"
      }
    }
  }
});

model.
    get(['users', 0, 'name']).
    subscribe(function(jsonEnv) {
        var userModel = model.deref(jsonEnv.json.users[0]);
        console.log(model.getPath());
        console.log(userModel.getPath());
   });
});

// prints the following:
// []
// ["usersById", 32] - because userModel refers to target of reference at ["users", 0]
 */
Model.prototype.getPath = function getPath() {
    return arrayClone(this._path);
};

/**
 * This one is actually private.  I would not use this without talking to
 * jhusain, sdesai, or michaelbpaulson (github).
 * @private
 */
Model.prototype._fromWhenceYouCame = function fromWhenceYouCame(allow) {
    return this._clone({
        _allowFromWhenceYouCame: allow === undefined ? true : allow
    });
};

Model.prototype._getBoundValue = require("./get/getBoundValue");
Model.prototype._getVersion = require("./get/getVersion");

Model.prototype._getPathValuesAsPathMap = get.getWithPathsAsPathMap;
Model.prototype._getPathValuesAsJSONG = get.getWithPathsAsJSONGraph;

Model.prototype._setPathValues = require("./set/setPathValues");
Model.prototype._setPathMaps = require("./set/setPathMaps");
Model.prototype._setJSONGs = require("./set/setJSONGraphs");
Model.prototype._setCache = require("./set/setPathMaps");

Model.prototype._invalidatePathValues = require("./invalidate/invalidatePathSets");
Model.prototype._invalidatePathMaps = require("./invalidate/invalidatePathMaps");
</code></pre>
    </article>
</section>
  

  
</main>



        
        <!--
          In case someone comes along later and sees the active item on the
          toc acting weirdly, hopefully they'll see this comment. This page, unlike
          any seen during development, has multiple 'docs' passed to container.tmpl.
          To debug it and enhance the page as needed, I would suggest looking there first.
        -->
        

        <!-- Generate the table of contents -->
        <nav class="table-of-contents api-doc-toc">
            <ul class="nav">
                <li>
                    <a href="DataSource.html">Classes</a>
                    <ul class="toc-api-classes">
                        
                            <li class="toc-api-class ">
                                <a href="DataSource.html" data-target="#DataSource">DataSource</a>
                                
                                

    <ul class="toc-api-subgroup toc-api-subgroup-methods">
        <li>
            <span class="toc-api-subgroup-title">Methods</span>
        </li>
        
            <li class="toc-api-subgroup-item">
                <a href="DataSource.html#call" data-target="#call">call</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="DataSource.html#get" data-target="#get">get</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="DataSource.html#set" data-target="#set">set</a>
            </li>
         
    </ul>


                                


                                


                            </li>
                        
                            <li class="toc-api-class ">
                                <a href="FromEsObserverAdapter.html" data-target="#FromEsObserverAdapter">FromEsObserverAdapter</a>
                                
                                


                                


                                


                            </li>
                        
                            <li class="toc-api-class ">
                                <a href="HttpDataSource.html" data-target="#HttpDataSource">HttpDataSource</a>
                                
                                

    <ul class="toc-api-subgroup toc-api-subgroup-methods">
        <li>
            <span class="toc-api-subgroup-title">Methods</span>
        </li>
        
            <li class="toc-api-subgroup-item">
                <a href="HttpDataSource.html#call" data-target="#call">call</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="HttpDataSource.html#get" data-target="#get">get</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="HttpDataSource.html#set" data-target="#set">set</a>
            </li>
         
    </ul>


                                


                                


                            </li>
                        
                            <li class="toc-api-class ">
                                <a href="Model.html" data-target="#Model">Model</a>
                                
                                

    <ul class="toc-api-subgroup toc-api-subgroup-methods">
        <li>
            <span class="toc-api-subgroup-title">Methods</span>
        </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#_setMaxSize" data-target="#_setMaxSize">_setMaxSize</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#asDataSource" data-target="#asDataSource">asDataSource</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#batch" data-target="#batch">batch</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#boxValues" data-target="#boxValues">boxValues</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#call" data-target="#call">call</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#deref" data-target="#deref">deref</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#get" data-target="#get">get</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#getCache" data-target="#getCache">getCache</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#getPath" data-target="#getPath">getPath</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#getVersion" data-target="#getVersion">getVersion</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#invalidate" data-target="#invalidate">invalidate</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#preload" data-target="#preload">preload</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#set" data-target="#set">set</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#setCache" data-target="#setCache">setCache</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#treatErrorsAsValues" data-target="#treatErrorsAsValues">treatErrorsAsValues</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#unbatch" data-target="#unbatch">unbatch</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#unboxValues" data-target="#unboxValues">unboxValues</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#withoutDataSource" data-target="#withoutDataSource">withoutDataSource</a>
            </li>
         
    </ul>


                                

    <ul class="toc-api-subgroup toc-api-subgroup-types">
        <li>
            <span class="toc-api-subgroup-title">Types</span>
        </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#~comparator" data-target="#\~comparator">comparator</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#~errorSelector" data-target="#\~errorSelector">errorSelector</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Model.html#~onChange" data-target="#\~onChange">onChange</a>
            </li>
         
    </ul>


                                


                            </li>
                        
                            <li class="toc-api-class ">
                                <a href="ModelResponse.html" data-target="#ModelResponse">ModelResponse</a>
                                
                                

    <ul class="toc-api-subgroup toc-api-subgroup-methods">
        <li>
            <span class="toc-api-subgroup-title">Methods</span>
        </li>
        
            <li class="toc-api-subgroup-item">
                <a href="ModelResponse.html#forEach" data-target="#forEach">forEach</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="ModelResponse.html#progressively" data-target="#progressively">progressively</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="ModelResponse.html#subscribe" data-target="#subscribe">subscribe</a>
            </li>
         
    </ul>


                                


                                


                            </li>
                        
                            <li class="toc-api-class ">
                                <a href="ModelResponseObserver.html" data-target="#ModelResponseObserver">ModelResponseObserver</a>
                                
                                


                                


                                


                            </li>
                        
                            <li class="toc-api-class ">
                                <a href="Observable.html" data-target="#Observable">Observable</a>
                                
                                

    <ul class="toc-api-subgroup toc-api-subgroup-methods">
        <li>
            <span class="toc-api-subgroup-title">Methods</span>
        </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Observable.html#forEach" data-target="#forEach">forEach</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Observable.html#subscribe" data-target="#subscribe">subscribe</a>
            </li>
         
    </ul>


                                

    <ul class="toc-api-subgroup toc-api-subgroup-types">
        <li>
            <span class="toc-api-subgroup-title">Types</span>
        </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Observable.html#~onCompletedCallback" data-target="#\~onCompletedCallback">onCompletedCallback</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Observable.html#~onErrorCallback" data-target="#\~onErrorCallback">onErrorCallback</a>
            </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Observable.html#~onNextCallback" data-target="#\~onNextCallback">onNextCallback</a>
            </li>
         
    </ul>


                                


                            </li>
                        
                            <li class="toc-api-class ">
                                <a href="Subscription.html" data-target="#Subscription">Subscription</a>
                                
                                

    <ul class="toc-api-subgroup toc-api-subgroup-methods">
        <li>
            <span class="toc-api-subgroup-title">Methods</span>
        </li>
        
            <li class="toc-api-subgroup-item">
                <a href="Subscription.html#dispose" data-target="#dispose">dispose</a>
            </li>
         
    </ul>


                                


                                


                            </li>
                        
                            <li class="toc-api-class ">
                                <a href="ToEsSubscriptionAdapter.html" data-target="#ToEsSubscriptionAdapter">ToEsSubscriptionAdapter</a>
                                
                                


                                


                                


                            </li>
                        
                    </ul>
                </li>
                <li class="toc-api-type-list ">
                    <a href="global.html">Global Types</a>
                    <ul class="toc-api-types">
                        
                            <li class="toc-api-type">
                                <a href="global.html#Atom" data-target="#Atom">Atom</a>
                            </li>
                        
                            <li class="toc-api-type">
                                <a href="global.html#JSONEnvelope" data-target="#JSONEnvelope">JSONEnvelope</a>
                            </li>
                        
                            <li class="toc-api-type">
                                <a href="global.html#JSONGraph" data-target="#JSONGraph">JSONGraph</a>
                            </li>
                        
                            <li class="toc-api-type">
                                <a href="global.html#JSONGraphEnvelope" data-target="#JSONGraphEnvelope">JSONGraphEnvelope</a>
                            </li>
                        
                            <li class="toc-api-type">
                                <a href="global.html#Key" data-target="#Key">Key</a>
                            </li>
                        
                            <li class="toc-api-type">
                                <a href="global.html#KeySet" data-target="#KeySet">KeySet</a>
                            </li>
                        
                            <li class="toc-api-type">
                                <a href="global.html#Path" data-target="#Path">Path</a>
                            </li>
                        
                            <li class="toc-api-type">
                                <a href="global.html#PathSet" data-target="#PathSet">PathSet</a>
                            </li>
                        
                            <li class="toc-api-type">
                                <a href="global.html#PathValue" data-target="#PathValue">PathValue</a>
                            </li>
                        
                            <li class="toc-api-type">
                                <a href="global.html#Range" data-target="#Range">Range</a>
                            </li>
                        
                    </ul>
                </li>
            </ul>
        </nav>





